/*
 * Copyright (c) 2011, 张达林
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 3. Neither the name of SlotBoard nor the names of its contributors may be used
 *    to endorse or promote products derived from this software without
 *    specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package cc.gpai.util.slotboard;

import java.awt.AWTEvent;
import java.awt.event.ActionEvent;
import java.awt.event.AdjustmentEvent;
import java.awt.event.ComponentEvent;
import java.awt.event.ContainerEvent;
import java.awt.event.FocusEvent;
import java.awt.event.HierarchyEvent;
import java.awt.event.InputMethodEvent;
import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.TextEvent;
import java.awt.event.WindowEvent;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import javax.swing.event.AncestorEvent;
import javax.swing.event.CaretEvent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.DocumentEvent;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.MenuDragMouseEvent;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuKeyEvent;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.RowSorterEvent;
import javax.swing.event.TableColumnModelEvent;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.UndoableEditEvent;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.tree.ExpandVetoException;

public class UniversalAdaptor<E> implements UniversalListener<E> {

	MyLinkedBlockingDeque<E> q = new MyLinkedBlockingDeque<E>();
	Map<String, Object> map = new HashMap<String, Object>();

	@Override
	public void setProperty(String key, Object value) {
		map.put(key, value);
	}

	@Override
	public Object getProperty(String key) {
		return map.get(key);
	}

	@Override
	public Collection<Object> getProperties(String key) {
		return Arrays.asList(map.get(key));
	}

	public void put(E e) throws InterruptedException {
		q.put(e);
	}

	public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {
		return q.offer(e, timeout, unit);
	}

	public E take() throws InterruptedException {
		return q.take();
	}

	public E poll(long timeout, TimeUnit unit) throws InterruptedException {
		return q.poll(timeout, unit);
	}

	public int remainingCapacity() {
		return q.remainingCapacity();
	}

	public int drainTo(Collection<? super E> c) {
		return q.drainTo(c);
	}

	public int drainTo(Collection<? super E> c, int maxElements) {
		return q.drainTo(c, maxElements);
	}

	public void putFirst(E e) throws InterruptedException {
		q.putFirst(e);
	}

	public void putLast(E e) throws InterruptedException {
		q.putLast(e);
	}

	public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException {
		return q.offerFirst(e, timeout, unit);
	}

	public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException {
		return q.offerLast(e, timeout, unit);
	}

	public E takeFirst() throws InterruptedException {
		return q.takeFirst();
	}

	public E takeLast() throws InterruptedException {
		return q.takeLast();
	}

	public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException {
		return q.pollFirst(timeout, unit);
	}

	public E pollLast(long timeout, TimeUnit unit) throws InterruptedException {
		return q.pollLast(timeout, unit);
	}

	public boolean isEmpty() {
		return q.isEmpty();
	}

	public E getFirst() {
		return q.getFirst();
	}

	public E getLast() {
		return q.getLast();
	}

	public E removeFirst() {
		return q.removeFirst();
	}

	public E removeLast() {
		return q.removeLast();
	}

	public void addFirst(E e) {
		q.addFirst(e);
	}

	public void addLast(E e) {
		q.addLast(e);
	}

	public boolean contains(Object o) {
		return q.contains(o);
	}

	public int size() {
		return q.size();
	}

	public boolean add(E e) {
		return q.add(e);
	}

	public boolean remove(Object o) {
		return q.remove(o);
	}

	public boolean addAll(Collection<? extends E> c) {
		return q.addAll(c);
	}

	public Iterator<E> iterator() {
		return q.iterator();
	}

	public boolean addAll(int index, Collection<? extends E> c) {
		return q.addAll(index, c);
	}

	public boolean containsAll(Collection<?> c) {
		return q.containsAll(c);
	}

	public ListIterator<E> listIterator() {
		return q.listIterator();
	}

	public void clear() {
		q.clear();
	}

	public E get(int index) {
		return q.get(index);
	}

	public boolean removeAll(Collection<?> c) {
		return q.removeAll(c);
	}

	public E set(int index, E element) {
		return q.set(index, element);
	}

	public void add(int index, E element) {
		q.add(index, element);
	}

	public boolean retainAll(Collection<?> c) {
		return q.retainAll(c);
	}

	public E remove(int index) {
		return q.remove(index);
	}

	public int indexOf(Object o) {
		return q.indexOf(o);
	}

	public int lastIndexOf(Object o) {
		return q.lastIndexOf(o);
	}

	public List<E> subList(int fromIndex, int toIndex) {
		return q.subList(fromIndex, toIndex);
	}

	public E peek() {
		return q.peek();
	}

	public E element() {
		return q.element();
	}

	public E poll() {
		return q.poll();
	}

	public E remove() {
		return q.remove();
	}

	public boolean offer(E e) {
		return q.offer(e);
	}

	public boolean offerFirst(E e) {
		return q.offerFirst(e);
	}

	public boolean offerLast(E e) {
		return q.offerLast(e);
	}

	public E peekFirst() {
		return q.peekFirst();
	}

	public E peekLast() {
		return q.peekLast();
	}

	public E pollFirst() {
		return q.pollFirst();
	}

	public E pollLast() {
		return q.pollLast();
	}

	public void push(E e) {
		q.push(e);
	}

	public E pop() {
		return q.pop();
	}

	public boolean removeFirstOccurrence(Object o) {
		return q.removeFirstOccurrence(o);
	}

	public boolean removeLastOccurrence(Object o) {
		return q.removeLastOccurrence(o);
	}

	public ListIterator<E> listIterator(int index) {
		return q.listIterator(index);
	}

	public Iterator<E> descendingIterator() {
		return q.descendingIterator();
	}

	public Object[] toArray() {
		return q.toArray();
	}

	public <T> T[] toArray(T[] a) {
		return q.toArray(a);
	}

	@Override
	public void actionPerformed(ActionEvent e) {

	}

	@Override
	public void adjustmentValueChanged(AdjustmentEvent e) {

	}

	@Override
	public void eventDispatched(AWTEvent event) {

	}

	@Override
	public void componentResized(ComponentEvent e) {

	}

	@Override
	public void componentMoved(ComponentEvent e) {

	}

	@Override
	public void componentShown(ComponentEvent e) {

	}

	@Override
	public void componentHidden(ComponentEvent e) {

	}

	@Override
	public void componentAdded(ContainerEvent e) {

	}

	@Override
	public void componentRemoved(ContainerEvent e) {

	}

	@Override
	public void focusGained(FocusEvent e) {

	}

	@Override
	public void focusLost(FocusEvent e) {

	}

	@Override
	public void ancestorMoved(HierarchyEvent e) {

	}

	@Override
	public void ancestorResized(HierarchyEvent e) {

	}

	@Override
	public void hierarchyChanged(HierarchyEvent e) {

	}

	@Override
	public void inputMethodTextChanged(InputMethodEvent event) {

	}

	@Override
	public void caretPositionChanged(InputMethodEvent event) {

	}

	@Override
	public void itemStateChanged(ItemEvent e) {

	}

	@Override
	public void keyTyped(KeyEvent e) {

	}

	@Override
	public void keyPressed(KeyEvent e) {

	}

	@Override
	public void keyReleased(KeyEvent e) {

	}

	@Override
	public void mouseClicked(MouseEvent e) {

	}

	@Override
	public void mousePressed(MouseEvent e) {

	}

	@Override
	public void mouseReleased(MouseEvent e) {

	}

	@Override
	public void mouseEntered(MouseEvent e) {

	}

	@Override
	public void mouseExited(MouseEvent e) {

	}

	@Override
	public void mouseDragged(MouseEvent e) {

	}

	@Override
	public void mouseMoved(MouseEvent e) {

	}

	@Override
	public void mouseWheelMoved(MouseWheelEvent e) {

	}

	@Override
	public void textValueChanged(TextEvent e) {

	}

	@Override
	public void windowGainedFocus(WindowEvent e) {

	}

	@Override
	public void windowLostFocus(WindowEvent e) {

	}

	@Override
	public void windowOpened(WindowEvent e) {

	}

	@Override
	public void windowClosing(WindowEvent e) {

	}

	@Override
	public void windowClosed(WindowEvent e) {

	}

	@Override
	public void windowIconified(WindowEvent e) {

	}

	@Override
	public void windowDeiconified(WindowEvent e) {

	}

	@Override
	public void windowActivated(WindowEvent e) {

	}

	@Override
	public void windowDeactivated(WindowEvent e) {

	}

	@Override
	public void windowStateChanged(WindowEvent e) {

	}

	@Override
	public void ancestorAdded(AncestorEvent event) {

	}

	@Override
	public void ancestorRemoved(AncestorEvent event) {

	}

	@Override
	public void ancestorMoved(AncestorEvent event) {

	}

	@Override
	public void caretUpdate(CaretEvent e) {

	}

	@Override
	public void editingStopped(ChangeEvent e) {

	}

	@Override
	public void editingCanceled(ChangeEvent e) {

	}

	@Override
	public void stateChanged(ChangeEvent e) {

	}

	@Override
	public int getOffset() {

		return 0;
	}

	@Override
	public int getLength() {

		return 0;
	}

	@Override
	public Document getDocument() {

		return null;
	}

	@Override
	public EventType getType() {

		return null;
	}

	@Override
	public ElementChange getChange(Element elem) {

		return null;
	}

	@Override
	public void insertUpdate(DocumentEvent e) {

	}

	@Override
	public void removeUpdate(DocumentEvent e) {

	}

	@Override
	public void changedUpdate(DocumentEvent e) {

	}

	@Override
	public Element getElement() {

		return null;
	}

	@Override
	public int getIndex() {

		return 0;
	}

	@Override
	public Element[] getChildrenRemoved() {

		return null;
	}

	@Override
	public Element[] getChildrenAdded() {

		return null;
	}

	@Override
	public void hyperlinkUpdate(HyperlinkEvent e) {

	}

	@Override
	public void internalFrameOpened(InternalFrameEvent e) {

	}

	@Override
	public void internalFrameClosing(InternalFrameEvent e) {

	}

	@Override
	public void internalFrameClosed(InternalFrameEvent e) {

	}

	@Override
	public void internalFrameIconified(InternalFrameEvent e) {

	}

	@Override
	public void internalFrameDeiconified(InternalFrameEvent e) {

	}

	@Override
	public void internalFrameActivated(InternalFrameEvent e) {

	}

	@Override
	public void internalFrameDeactivated(InternalFrameEvent e) {

	}

	@Override
	public void intervalAdded(ListDataEvent e) {

	}

	@Override
	public void intervalRemoved(ListDataEvent e) {

	}

	@Override
	public void contentsChanged(ListDataEvent e) {

	}

	@Override
	public void valueChanged(ListSelectionEvent e) {

	}

	@Override
	public void menuDragMouseEntered(MenuDragMouseEvent e) {

	}

	@Override
	public void menuDragMouseExited(MenuDragMouseEvent e) {

	}

	@Override
	public void menuDragMouseDragged(MenuDragMouseEvent e) {

	}

	@Override
	public void menuDragMouseReleased(MenuDragMouseEvent e) {

	}

	@Override
	public void menuKeyTyped(MenuKeyEvent e) {

	}

	@Override
	public void menuKeyPressed(MenuKeyEvent e) {

	}

	@Override
	public void menuKeyReleased(MenuKeyEvent e) {

	}

	@Override
	public void menuSelected(MenuEvent e) {

	}

	@Override
	public void menuDeselected(MenuEvent e) {

	}

	@Override
	public void menuCanceled(MenuEvent e) {

	}

	@Override
	public void popupMenuWillBecomeVisible(PopupMenuEvent e) {

	}

	@Override
	public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {

	}

	@Override
	public void popupMenuCanceled(PopupMenuEvent e) {

	}

	@Override
	public void sorterChanged(RowSorterEvent e) {

	}

	@Override
	public void columnAdded(TableColumnModelEvent e) {

	}

	@Override
	public void columnRemoved(TableColumnModelEvent e) {

	}

	@Override
	public void columnMoved(TableColumnModelEvent e) {

	}

	@Override
	public void columnMarginChanged(ChangeEvent e) {

	}

	@Override
	public void columnSelectionChanged(ListSelectionEvent e) {

	}

	@Override
	public void tableChanged(TableModelEvent e) {

	}

	@Override
	public void treeExpanded(TreeExpansionEvent event) {

	}

	@Override
	public void treeCollapsed(TreeExpansionEvent event) {

	}

	@Override
	public void treeNodesChanged(TreeModelEvent e) {

	}

	@Override
	public void treeNodesInserted(TreeModelEvent e) {

	}

	@Override
	public void treeNodesRemoved(TreeModelEvent e) {

	}

	@Override
	public void treeStructureChanged(TreeModelEvent e) {

	}

	@Override
	public void valueChanged(TreeSelectionEvent e) {

	}

	@Override
	public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {

	}

	@Override
	public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {

	}

	@Override
	public void undoableEditHappened(UndoableEditEvent e) {

	}

	@Override
	public Object actionPerformed(Object... arg) {

		return null;
	}
}
